<?php
// $Id$

/**
 * Controller_Admin_Product 控制器
 */
class Controller_Admin_Product extends Controller_Abstract
{
	
	
	function actionIndex()
	{
        
	}
	function actiondel()
	{
	$this->union_table = Product::meta();
	
	$this->delete(array('id'=>$this->_context->ids));
	}
	function actionsearch()
	{
	
	}
	
	/**
	 * 
	 *2011-12-20-上午09:56:50 by 460932465
	 * @access 点卡显示
	 */
	function actionlist()
	{
		$this->page_size = 5;
		$this->union_table = Product::meta();
		$this->lists(array('type'=>0));
	}
		
	function actionadd()
	{
	
	$url = url($this->_context->controller_name.'/'.$this->_context->action_name);
	$Form  = new Form_Productadd($url);
	$cardTypes = Categorys::find("catepath like '0,78,%'")->setColumns('id,catename')->order('catepath asc,order desc')->asArray()->getAll(); 
	$cateArr = array();
	foreach ($cardTypes as $k=>$v)
	{
		$cateArr[$v['id']] = $v['catename']; 
	}
	$Form->element('categorysid')->items = $cateArr;
	$auto = new helper_autoinsert(Product::meta());
	$result = $auto->add($Form,'id',$_GET);
	if ($this->_context->isGET())
	{
		$this->_view['form'] = $result;
	}else
	{
		return call_user_func_array(array($this,$auto->status),$result);
	}
	}
}


